<?php
/**
 * 车型模型
 *
 * PHP version 7
 *
 * @category  Business
 * @package   App\Models\Business
 * @author    Yisheng Zheng <zhengys@boqii.com>
 * @copyright 2016-2019 zhengys Co. All Rights Reserved.
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License
 * @version   GIT:<git_id>
 * @link      http://shop.openapi.boqii.com
 */
namespace App\Models\Mator;

use App\Models\Model;
use Cache;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Config;

class Mator extends Model
{
    /**
     * 车型模型
     *
     * @var string
     */
    protected $table = 'e_mator';
	
	protected static $_instance = null;
	
	/**
	 * 单例模式
	 *
     * @access public
     * @return mixed
     */
	public static function getInstance()
	{
		if (self::$_instance === null) {
            self::$_instance = new self();
        }
        return self::$_instance;
	}
	
	/**
	 * 领域
	 *
	 * @param Request $request
     * @access public
     * @return mixed
     */
	public function getFeildWhere($where)
	{
		return DB::table('e_field')->where($where)->get()->toArray();
	}
	
	/**
	 * 国家
	 *
	 * @param Request $request
     * @access public
     * @return mixed
     */
	public function getCountryWhere($where)
	{
		return DB::table('e_country')->where($where)->get()->toArray();
	}
	
	/**
	 * 领域与国家（车型库）
	 *
	 * @param Request $request
     * @access public
     * @return mixed
     */
	public function getFeildCountryWhere($where)
	{
		return DB::table('e_field_country')->where($where)->get()->toArray();
	}
	
	/**
	 * 制造商
	 *
	 * @param Request $request
     * @access public
     * @return mixed
     */
	public function getMakeWhere($where)
	{
		return DB::table('e_make')->where($where)->get()->toArray();
	}
	
	/**
	 * 系列
	 *
	 * @param Request $request
     * @access public
     * @return mixed
     */
	public function getSeriesWhere($where)
	{
		return DB::table('e_series')->where($where)->get()->toArray();
	}
	
	/**
	 * 车型
	 *
	 * @param Request $request
     * @access public
     * @return mixed
     */
	public function getMatorWhere($where)
	{
		return DB::table('e_mator')->where($where)->get()->toArray();
	}
	
}
